<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>文章信息</title>
    <link rel="stylesheet" type="text/css" th:href="@{/css/styles.css}">
</head>
<body>
<h2>文章信息</h2>

<div class="col-sm-4">
    <a href="/article/page?pageIndex=0" th:href="@{/article/page?pageIndex=0}" class="btn-blue">首页</a>
    <a th:if="${pre >= 0}" href="#" th:href="@{/article/page(pageIndex=${pre})}" class="btn-blue">上一页</a>
    <a th:if="${next < page.totalPages}" href="#" th:href="@{/article/page(pageIndex=${next})}" class="btn-blue">下一页</a>
    <a href="/article/page?pageIndex=0" th:href="@{/article/page(pageIndex=${page.totalPages - 1})}" class="btn-blue">末页</a>
</div>
<br>
<a th:href="@{/article/add}" class="btn-blue">新增文章</a>
<a th:href="@{/article/search}" class="btn-blue">搜索文章</a>
<a th:href="@{/index}" class="btn-blue">回到首页</a>
<table>
    <thead>
    <tr>
        <th>文章编号</th>
        <th>文章标题</th>
        <th>文章内容</th>
        <th>发布时间</th>
        <th>用户编号</th>
        <th>文章类型编号</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <tr th:each="article : ${page.content}">
        <td th:text="${article.id}"></td>
        <td th:text="${article.title}"></td>
        <td th:text="${article.content}" style="max-width: 400px;"></td>
        <td th:text="${article.pubDate}"></td>
        <td th:text="${article.userId}"></td>
        <td th:text="${article.articleTypeId}"></td>
        <td>
            <a th:href="@{'/article/edit/' + ${article.id}}" class="btn-gray">编辑</a>
            <a th:href="@{'/article/delete/' + ${article.id}}" class="btn-red">删除</a>
        </td>
    </tr>
    </tbody>
</table>
</body>
</html>
